using System;
using System.Collections.Generic;
using System.Text;

using View;
using Task;

namespace Presenter
{
    /// <summary>
    /// Video Presenter.
    /// </summary>
    public sealed class VideoPresenter
    {
        #region Members

        /// <summary>
        /// View.
        /// </summary>
        private IVideoView view;

        /// <summary>
        /// Task.
        /// </summary>
        private VideoTask task;

        #endregion Members

        #region Construction/Finalization

        /// <summary>
        /// Initializes a new instance of the <see cref="MapPresenter"/> class.
        /// </summary>
        /// <param name="view">The view.</param>
        public VideoPresenter(IVideoView view)
        {
            this.view = view;
            task = new VideoTask();
        }

        #endregion Construction/Finalization

        #region Public Methods

        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public void Initialize()
        {
            //do nothing
        }

        /// <summary>
        /// Searches for videos.
        /// </summary>
        public void SearchForVideos()
        {
            view.SetSearchResults(task.SearchForVideos(view.SearchText, view.CurrentPage));
        }

        /// <summary>
        /// Sets the video.
        /// </summary>
        public void SetVideo()
        {
            view.SetCurrentVideo(task.GetVideoByID(view.VideoId));
        }

        #endregion Public Methods
    }
}
